package com.derbysoft.synxisadapter.action.monitor.cachestatistics;

import com.derbysoft.synxisadapter.action.BaseAdapterAction;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.hibernate.SessionFactory;
import org.hibernate.stat.Statistics;
import org.springframework.beans.factory.annotation.Autowired;

@Results(value = {
    @Result(name = Action.SUCCESS, location = "/page/monitor/cachestatistics/View.ftl")
})
public class ViewAction extends BaseAdapterAction{
    @Autowired
    private SessionFactory sessionFactory;

    private Statistics statistics;

    @Override
    public String execute() throws Exception {
        statistics = sessionFactory.getStatistics();
        return SUCCESS;
    }

    public Statistics getStatistics() {
        return statistics;
    }
}
